"""
字典
"""

"""
增
"""
# a = {} # 创建一个空字典
# b = dict() # 创建一个空字典

# name = {}
# name["Shawn"] = "高一八班"
# name["Tom"] = "高一七班"
# name["Jerry"] = "高一六班"
# print(name)
# # print(id(name))
# print("################################################")
# # name_2 = name.copy()
# # print(name_2)
# # print(id(name_2))
# # name_2 = {}
# # name_2["Jack"] = "高一五班"
# # name.update(name_2)
# # print(name)

"""
删
"""
# name = {"Shawn": "高一八班", "Tom": "高一七班", "Jerry": "高一六班", "Jack": "高一五班", "Tomy": "高一七班"}
# # name.clear()
# # del name["Shawn"]
# # the_delete_part = name.pop("Shawn")
# # print(the_delete_part)
# name.popitem()
# print(name)

"""
改
"""
# name = {"Shawn": "高一八班", "Tom": "高一七班", "Jerry": "高一六班", "Jack": "高一五班", "Tomy": "高一七班"}
# print(name)
# print(type(name))
# result = str(name)
# print(result)
# print(type(result))

"""
查
"""
name = {"Shawn": "高一八班", "Tom": "高一七班", "Jerry": "高一六班", "Jack": "高一五班", "Tomy": "高一七班"}

value = "高一七班"
for k, v in name.items():
    if v == value:
        print(k)



# # print(len(name))
# # print(name["Shirley"])
# print("******************************************")
# # print(name.get("Shirley", "没有这个元素"))
# # print(name.setdefault("Shirley", "没有这个元素"))
# # print(name.keys())
# # print(name.values())
# result = name.items()
# the = list(result)
# print(the[2][0])
# # if "Shawns" in name:
# #     print("Shawn在字典中")
# # else:
# #     print("Shawn不在字典中")
